package com.tuweiya.study.springboot002.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 通过@Value注解读取配置文件信息
 *  |- 直接读取，并返回给前台
 *
 */
@RestController
@RequestMapping(value = "/read")
public class ReadPropertyController {

    @Value("${my.name}")
    private String name;

    @Value("${my.age}")
    private int age;

    @RequestMapping(value = "/property")
    public String readProperty(){
        return "My name is " + name + " and age is " + age;
    }


}
